import React from "react";
import { Navigate } from "react-router-dom";
import { GoodsmanagementCom } from "../pages/Goodsmanagement";
import { ProductListCom } from "../pages/Goodsmanagement/Product List";
import { ProductCategoryCom } from "../pages/Goodsmanagement/ProductCategory";
import { HomeCom } from "../pages/home";
import { Login } from "../pages/Login";
import { PaymentCom } from "../pages/Payment";
import { PaymentTypeCom } from "../pages/Payment/PaymentType";
import { PicturemanagementCom } from "../pages/Picturemanagement";
import { ChartmanagementCom } from "../pages/Picturemanagement/Chartmanagement";
import { TransactionmanagementCom } from "../pages/Transactionmanagement";
import { AmountCom } from "../pages/Transactionmanagement/Amount";
import { OrdermanagementCom } from "../pages/Transactionmanagement/Ordermanagement";
import { RefundCom } from "../pages/Transactionmanagement/Refund";
import { Welcome } from "../pages/Welcome";
type Ichildren = {
  label?: string;
  key?: string;
  path: string;
  element: React.ReactNode;
  children?: Array<Ichildren>;
};

type Iroute = {
  label?: string;
  key?: string;
  path: string;
  element: React.ReactNode;
  children?: Array<Ichildren>;
};

let route: Array<Iroute> = [
  {
    path: "/login",
    element: <Login></Login>,
  },
  {
    path: "/",
    element:<Navigate to="/welcome"></Navigate>,
  },
  {
    path:"Goodsmanagement",
    element:<Navigate to="/Goodsmanagement/ProductCategory"></Navigate>,
  },
  {
    path: "/",
    element: <HomeCom></HomeCom>,
    children: [
      {
        path: "welcome",
        key: "welcome",
        element: <Welcome></Welcome>,
        label: "wel",
      },
      {
        path: "Goodsmanagement",
        key: "Goodsmanagement",
        element: <GoodsmanagementCom></GoodsmanagementCom>,
        label: "商品管理",
        children: [
          {
            label: "商品分类",
            path: "ProductCategory",
            key: "ProductCategory",
            element: <ProductCategoryCom></ProductCategoryCom>,
          },
          {
            label: "商品列表",
            path: "ProductList",
            key: "ProductList",
            element: <ProductListCom></ProductListCom>,
          },
        ],
      },
      {
        path: "Picturemanagement",
        key: "Picturemanagement",
        element: <PicturemanagementCom></PicturemanagementCom>,
        label: "图片管理",
        children: [
          {
            path: "Chartmanagement",
            key: "Chartmanagement",
            element: <ChartmanagementCom></ChartmanagementCom>,
            label: "轮播图管理",
          },
        ],
      },
      {
        path: "Transactionmanagement",
        key: "Transactionmanagement",
        element: <TransactionmanagementCom></TransactionmanagementCom>,
        label: "交易管理",
        children: [
          {
            path: "Amount",
            key: "Amount",
            element: <AmountCom></AmountCom>,
            label: "交易金额",
          },
          {
            path: "Ordermanagement",
            key: "Ordermanagement",
            element: <OrdermanagementCom></OrdermanagementCom>,
            label: "订单管理",
          },
          {
            path: "Refund",
            key: "Refund",
            element: <RefundCom></RefundCom>,
            label: "退款管理",
          },
        ],
      },
      {
        path: "Payment",
        key: "Payment",
        element: <PaymentCom></PaymentCom>,
        label: "支付管理",
        children: [
          {
            path: "PaymentType",
            key: "PaymentType",
            element: <PaymentTypeCom></PaymentTypeCom>,
            label: "支付类型",
          },
        ],
      },
    ],
  },
];

export default route;
